package com.langshixiaobai;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class A {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Class<?> aClass = Class.forName("com.langshixiaobai.B");
        Constructor<?> constructor = aClass.getDeclaredConstructor(null);
        // 设置private 修饰符为可见
        constructor.setAccessible(true);
        B b1 = (B)constructor.newInstance();
        B b2 = (B)constructor.newInstance();
        // 返回结果为false 代表两个实例
        System.out.println(b1.equals(b2));
        System.out.println(b1 == b2);

    }
}
